package com.sino.tb;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import xpubbean.Db.Conn;

public class BoardList {
	private static String sql;
	private static Statement st;
	private static ResultSet rs;
	public static List list;
	static{
		Conn conn = new Conn();
		Connection connection = conn.getConnectionHigh();
		try {
		st = connection.createStatement();
		sql = "select * from t_call_board where trunc(sysdate) between to_date(c_begin_date, 'yyyymmdd') and to_date(c_end_date, 'yyyymmdd') and c_sys_flag = 1";
		rs = st.executeQuery(sql);
		list = new ArrayList();
		while(rs.next()){
			Board board = new Board();
			board.setC_title(rs.getString("c_title"));
			board.setC_content(rs.getString("c_content"));
			list.add(board);
		}
		connection.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public List getBoard() {
		return list;
	}

	public static void loadBoard(){
		Conn conn = new Conn();
		Connection connection = conn.getConnection();
		try {
			st = connection.createStatement();
			sql = "select * from t_call_board where trunc(sysdate) between to_date(c_begin_date, 'yyyymmdd') and to_date(c_end_date, 'yyyymmdd') and c_sys_flag = 1";
			rs = st.executeQuery(sql);
			list = new ArrayList();
			while(rs.next()){
				Board board = new Board();
				board.setC_title(rs.getString("c_title"));
				board.setC_content(rs.getString("c_content"));
				list.add(board);
			}
			connection.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
